Skip to content

docs: Fix Flutter client imports, client exception example, and the real-time tutorial for 4.0 - #806

Open
FXschwartz wants to merge 4 commits into
serverpod:mainfrom
FXschwartz:794-795-797-client-exceptions-and-tutorial
Open

docs: Fix Flutter client imports, client exception example, and the real-time tutorial for 4.0#806
FXschwartz wants to merge 4 commits into
serverpod:mainfrom
FXschwartz:794-795-797-client-exceptions-and-tutorial

Conversation

@FXschwartz

Copy link
Copy Markdown
Contributor

Markdownlint passes on all changed files except for nine pre-existing findings on the Facebook setup page, outside the edited section.

Fixes #794, fixes #795, fixes #797.

@FXschwartz
FXschwartz requested review from a team and marcelomendoncasoares September 8, 2026 21:54
@FXschwartz FXschwartz self-assigned this Sep 8, 2026
Comment on lines +221 to 224
} on ServerpodClientHttpException catch (e) {
// The server returned an error, for example a 500.
showError('Something went wrong (${e.statusCode}). Please try again.');
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: line 204 says to fall back to the general case, but the last clause here is a specific one now. Adding the catch-all back also re-covers ServerpodClientUnknownException, which the previous on ServerpodClientException caught.

Suggested change
} on ServerpodClientHttpException catch (e) {
// The server returned an error, for example a 500.
showError('Something went wrong (${e.statusCode}). Please try again.');
}
} on ServerpodClientHttpException catch (e) {
// The server returned an error, for example a 500.
showError('Something went wrong (${e.statusCode}). Please try again.');
} on ServerpodClientException catch (_) {
// Anything else the client could not classify.
showError('Something went wrong. Please try again.');
}


client = Client(serverUrl)
Future<void> initializeClient() async {
client = Client(await getServerUrl())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: the template has a top-level final serverUrl = getServerUrl(); and then Client(await serverUrl), which is also the form the other pages in this PR use. The getServerUrl() explanation below still reads fine, since serverUrl is that call's result.

Suggested change
client = Client(await getServerUrl())
client = Client(await serverUrl)

@@ -197,8 +197,10 @@ fields:
A call from the client can fail in three ways, and you usually handle each one differently:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: with the catch-all added back, the list runs to four: a serializable exception, ServerpodClientHttpException, ServerpodClientNetworkException, and whatever ServerpodClientException catches last.

Suggested change
A call from the client can fail in three ways, and you usually handle each one differently:
A call from the client can fail in a few ways, and you usually handle each one differently:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants